<!DOCTYPE html>
<html>
<head>
  <meta charset='UTF-8'/>
  <link rel="stylesheet" href="../../dist/mapbox.css"/>
  <link rel="stylesheet" href="embed.css"/>
  <script src="../../dist/mapbox.js"></script>
  <script src="access_token.js"></script>
</head>
<body>
<style>
    #map-ui {
        position: absolute;
        top: 80px;
        left: 10px;
        list-style: none;
        margin: 0;
        padding: 0;
        z-index: 1;
    }

    #map-ui a {
        font: normal 13px/18px 'Helvetica Neue', Helvetica, sans-serif;
        background: #FFF;
        color: #3C4E5A;
        display: block;
        margin: 0;
        padding: 0;
        border: 1px solid #BBB;
        border-bottom-width: 0;
        min-width: 138px;
        padding: 10px;
        text-decoration: none;
    }

    #map-ui a:hover {
        background: #ECF5FA;
    }

    #map-ui li:last-child a {
        border-bottom-width: 1px;
        -webkit-border-radius: 0 0 3px 3px;
        border-radius: 0 0 3px 3px;
    }

    #map-ui li:first-child a {
        -webkit-border-radius: 3px 3px 0 0;
        border-radius: 3px 3px 0 0;
    }

    #map-ui a.active {
        background: #3887BE;
        border-color: #3887BE;
        border-top-color: #FFF;
        color: #FFF;
    }
</style>
<ul id='map-ui'></ul>
<div id='map'></div>
<script>
    var map = L.mapbox.map('map').setView([38.902, -77.001], 13);
    var ui = document.getElementById('map-ui');

    addLayer(L.mapbox.tileLayer('tristen.map-ixqro653'), 'Mapbox Streets');
    addLayer(L.mapbox.tileLayer('tmcw.dc-ddot-bike-lanes'), 'Bike Lanes');
    addLayer(L.mapbox.featureLayer('tmcw.map-j5a868tu'), 'Coffee Shops');

    function addLayer(layer, name) {

        layer.addTo(map);

        // Create a simple layer switcher that toggles layers on
        // and off.
        var item = document.createElement('li');
        var link = document.createElement('a');

        link.href = '#';
        link.className = 'active';
        link.innerHTML = name;

        link.onclick = function(e) {
            e.preventDefault();
            e.stopPropagation();

            if (map.hasLayer(layer)) {
                map.removeLayer(layer);
                this.className = '';
            } else {
                map.addLayer(layer);
                this.className = 'active';
            }
        };

        item.appendChild(link);
        ui.appendChild(item);
    }
</script>
</body>
</html>
